package com.carl.lambda.simpleLambda.damand03;

import org.junit.Test;

/**
 * ①声明函数式接口,带两个泛型,泛型类型是<T,R>  T参数 R返回值 接口中声明抽象方法
 * ②在测试类中声明方法,使用接口作为参数,计算两个long型的参数和
 * ③再计算两个long型参数的乘积
 */
public class LambdaTest {



    @Test
    public void add(){
        Long operation = operation(5L, 9L, Long::sum);
        System.out.println(operation);
    }

    @Test
    public void x(){
        Long operation = operation(2L, 9L, (x, y) -> x * y);
        System.out.println(operation);
    }




    public Long operation(Long num1,Long num2,MyFunction<Long,Long> myFunction){
          return myFunction.getValue(num1, num2);
    }
}
